﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KarReq.Domain.Abstract;
using KarReq.WebUI.Models;

namespace KarReq.WebUI.Controllers
{
    [Authorize]
    public class NavController : KarReqController
    {
        public NavController(IKaraokeTrackRepository repo) : base(repo) { }

        public PartialViewResult Menu(string category = null)
        {
            ViewBag.SelectedCategory = category;

            IEnumerable<string> categories = repository.KaraokeTracks
                                .Select(x => x.Artist.Substring(0,1) )
                                .Distinct()
                                .OrderBy(x => x);

            return PartialView(categories);
        }
    }
}
